home *** CD-ROM | disk | FTP | other *** search
/ Your Web Site Creator / Your Web Site Creator.iso / WebSite / data1.cab / Program_Executable_Files / Classes / MARQUEE2.CLA (.txt) < prev    next >
Encoding:
Java Class File  |  1999-01-13  |  3.9 KB  |  172 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Graphics;
  5. import java.awt.Image;
  6. import java.awt.image.ImageObserver;
  7.  
  8. public class MarqueeBorderPanel2 extends DynamicBorderPanel2 {
  9.    int lightCountX;
  10.    int lightCountY;
  11.    int[] xPos;
  12.    int[] yPos;
  13.    final int lightCount = 4;
  14.    Image osImage;
  15.    Graphics osg;
  16.    Color lightColor;
  17.    Color offColor;
  18.    Image onLightImage;
  19.    Image offLightImage;
  20.  
  21.    void GetParameters(Applet var1, int var2) {
  22.       String var3 = var1.getParameter("marqueeBorderThickness" + var2);
  23.       ((BorderPanel2)this).SetThickness(AppletParam2.GetInt(var3, 5));
  24.       var3 = var1.getParameter("marqueeBorderBkColor" + var2);
  25.       ((BorderPanel2)this).SetBackgroundColor(AppletParam2.GetColor(var3, (Color)null));
  26.       var3 = var1.getParameter("marqueeBorderBkImage" + var2);
  27.       ((BorderPanel2)this).SetBackgroundImage(AppletParam2.GetImage(var1, var3));
  28.       var3 = var1.getParameter("marqueeBorderLightColor" + var2);
  29.       this.SetLightColor(AppletParam2.GetColor(var3, Color.yellow));
  30.       var3 = var1.getParameter("marqueeBorderOffColor" + var2);
  31.       this.SetOffColor(AppletParam2.GetColor(var3, Color.black));
  32.       var3 = var1.getParameter("marqueeBorderOnLightImage" + var2);
  33.       this.SetOnLightImage(AppletParam2.GetImage(var1, var3));
  34.       var3 = var1.getParameter("marqueeBorderOffLightImage" + var2);
  35.       this.SetOffLightImage(AppletParam2.GetImage(var1, var3));
  36.    }
  37.  
  38.    public MarqueeBorderPanel2(Applet var1, int var2) {
  39.       this.lightColor = Color.yellow;
  40.       this.offColor = Color.white;
  41.       this.GetParameters(var1, var2);
  42.       this.xPos = new int[4];
  43.       this.yPos = new int[4];
  44.    }
  45.  
  46.    public void SetLightColor(Color var1) {
  47.       this.lightColor = new Color(var1.getRGB());
  48.    }
  49.  
  50.    public void SetOffColor(Color var1) {
  51.       this.offColor = new Color(var1.getRGB());
  52.    }
  53.  
  54.    public void SetOnLightImage(Image var1) {
  55.       this.onLightImage = var1;
  56.    }
  57.  
  58.    public void SetOffLightImage(Image var1) {
  59.       this.offLightImage = var1;
  60.    }
  61.  
  62.    public void DoPaint(Graphics var1) {
  63.       if (this.osImage == null) {
  64.          this.lightCountX = ((Component)this).size().width / super.thickness;
  65.          this.lightCountY = ((Component)this).size().height / super.thickness;
  66.          this.xPos[0] = 0;
  67.          this.yPos[0] = 0;
  68.          this.xPos[1] = this.lightCountX - 1;
  69.          this.yPos[1] = 0;
  70.          this.xPos[2] = 0;
  71.          this.yPos[2] = this.lightCountY - 1;
  72.          this.xPos[3] = this.lightCountX - 1;
  73.          this.yPos[3] = this.lightCountY - 1;
  74.          this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
  75.          this.osg = this.osImage.getGraphics();
  76.       }
  77.  
  78.       if (this.offColor != null) {
  79.          this.osg.setColor(this.offColor);
  80.       } else {
  81.          this.osg.setColor(Color.lightGray);
  82.       }
  83.  
  84.       for(int var2 = 0; var2 < this.lightCountX; ++var2) {
  85.          if (this.offLightImage == null) {
  86.             this.osg.fillOval(var2 * super.thickness, 0, super.thickness - 1, super.thickness - 1);
  87.             this.osg.fillOval(var2 * super.thickness, ((Component)this).size().height - super.thickness, super.thickness - 1, super.thickness - 1);
  88.          } else {
  89.             this.osg.drawImage(this.offLightImage, var2 * super.thickness, 0, (ImageObserver)null);
  90.             this.osg.drawImage(this.offLightImage, var2 * super.thickness, ((Component)this).size().height - super.thickness, (ImageObserver)null);
  91.          }
  92.       }
  93.  
  94.       for(int var3 = 0; var3 < this.lightCountY; ++var3) {
  95.          if (this.offLightImage == null) {
  96.             this.osg.fillOval(0, var3 * super.thickness, super.thickness - 1, super.thickness - 1);
  97.             this.osg.fillOval(((Component)this).size().width - super.thickness, var3 * super.thickness, super.thickness - 1, super.thickness - 1);
  98.          } else {
  99.             this.osg.drawImage(this.offLightImage, 0, var3 * super.thickness, (ImageObserver)null);
  100.             this.osg.drawImage(this.offLightImage, ((Component)this).size().width - super.thickness, var3 * super.thickness, (ImageObserver)null);
  101.          }
  102.       }
  103.  
  104.       if (this.lightColor != null) {
  105.          this.osg.setColor(this.lightColor);
  106.       } else {
  107.          this.osg.setColor(Color.yellow);
  108.       }
  109.  
  110.       for(int var4 = 0; var4 < 4; ++var4) {
  111.          if (this.yPos[var4] == 0) {
  112.             if (this.onLightImage == null) {
  113.                this.osg.fillOval(this.xPos[var4] * super.thickness, 0, super.thickness - 1, super.thickness - 1);
  114.             } else {
  115.                this.osg.drawImage(this.onLightImage, this.xPos[var4] * super.thickness, 0, (ImageObserver)null);
  116.             }
  117.          }
  118.  
  119.          if (this.xPos[var4] == 0) {
  120.             if (this.onLightImage == null) {
  121.                this.osg.fillOval(0, this.yPos[var4] * super.thickness, super.thickness - 1, super.thickness - 1);
  122.             } else {
  123.                this.osg.drawImage(this.onLightImage, 0, this.yPos[var4] * super.thickness, (ImageObserver)null);
  124.             }
  125.          }
  126.  
  127.          if (this.yPos[var4] == this.lightCountY - 1) {
  128.             if (this.onLightImage == null) {
  129.                this.osg.fillOval(this.xPos[var4] * super.thickness, ((Component)this).size().height - super.thickness, super.thickness - 1, super.thickness - 1);
  130.             } else {
  131.                this.osg.drawImage(this.onLightImage, this.xPos[var4] * super.thickness, ((Component)this).size().height - super.thickness, (ImageObserver)null);
  132.             }
  133.          }
  134.  
  135.          if (this.xPos[var4] == this.lightCountX - 1) {
  136.             if (this.onLightImage == null) {
  137.                this.osg.fillOval(((Component)this).size().width - super.thickness, this.yPos[var4] * super.thickness, super.thickness - 1, super.thickness - 1);
  138.             } else {
  139.                this.osg.drawImage(this.onLightImage, ((Component)this).size().width - super.thickness, this.yPos[var4] * super.thickness, (ImageObserver)null);
  140.             }
  141.          }
  142.       }
  143.  
  144.       for(int var5 = 0; var5 < 4; ++var5) {
  145.          if (this.xPos[var5] == 0 && this.yPos[var5] == 0) {
  146.             int var12 = this.xPos[var5]++;
  147.          } else if (this.xPos[var5] == this.lightCountX - 1 && this.yPos[var5] == 0) {
  148.             int var11 = this.yPos[var5]++;
  149.          } else if (this.xPos[var5] == this.lightCountX - 1 && this.yPos[var5] == this.lightCountY - 1) {
  150.             int var10 = this.xPos[var5]--;
  151.          } else if (this.xPos[var5] == 0 && this.yPos[var5] == this.lightCountY - 1) {
  152.             int var9 = this.yPos[var5]--;
  153.          } else if (this.xPos[var5] > 0 && this.xPos[var5] < this.lightCountX - 1 && this.yPos[var5] == 0) {
  154.             int var8 = this.xPos[var5]++;
  155.          } else if (this.xPos[var5] > 0 && this.xPos[var5] < this.lightCountX - 1 && this.yPos[var5] == this.lightCountY - 1) {
  156.             int var7 = this.xPos[var5]--;
  157.          } else if (this.xPos[var5] == 0 && this.yPos[var5] > 0 && this.yPos[var5] < this.lightCountY - 1) {
  158.             int var6 = this.yPos[var5]--;
  159.          } else if (this.xPos[var5] == this.lightCountX - 1 && this.yPos[var5] > 0 && this.yPos[var5] < this.lightCountY - 1) {
  160.             int var10002 = this.yPos[var5]++;
  161.          }
  162.       }
  163.  
  164.       var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
  165.    }
  166.  
  167.    void DoResize(int var1, int var2) {
  168.       this.osImage = null;
  169.       this.osg = null;
  170.    }
  171. }
  172.